import tcdIO.*;

	class LockApp {

	public static void main(String[] args) {

		Lock lock1;
		int instruction;
		Terminal terminal1;
		
		terminal1 = new Terminal();
		
		lock1 = new Lock(72,64,91);
		
		instruction = 0;
		
		while(instruction == 0){
			
			instruction = terminal1.readInt("Enter 1 to check lock status, 2 to close lock, 3 to check if lock is jammed, 4 to attempt to open lock: ");
			
			if(instruction == 1){
				terminal1.println(lock1.getStatus());
				instruction = 0;
			}
			
			else if (instruction == 2){
				lock1.closeLock();
				instruction = 0;
			}
			
			else if(instruction == 3){
				
				if(lock1.checkJam() == true){
					terminal1.println("Lock is jammed");
				}
				else{
					terminal1.println("Lock is not jammed");
				}
				
				instruction = 0;
			}
			
			else if (instruction == 4){
				int entry1,entry2,entry3;
				
				entry1 = (terminal1.readInt("Enter first number in combination: "));
				
				entry2 = (terminal1.readInt("Enter second number in combination: "));
				
				entry3 = (terminal1.readInt("Enter third number in combination: "));
				
				lock1.attemptOpen(entry1, entry2, entry3);
				
				instruction = 0;
			}
			
		}

	}

}
